//
//  HomeViewController.m
//  FruitsWholesaler
//
//  Created by sgone-2 on 15/11/16.
//  Copyright © 2015年 sgone. All rights reserved.
//

#import "HomeViewController.h"
#import "DLTabedSlideView.h"
#import "OneViewController.h"
#import "TwoViewController.h"
#import "ThreeViewController.h"
#import "DDHZController.h"

@interface HomeViewController ()<DLTabedSlideViewDelegate>
@property (weak, nonatomic) IBOutlet DLTabedSlideView *tabedSlideView;

@end

@implementation HomeViewController




-(void)viewWillAppear:(BOOL)animated

{


    
    if (self.tabBarController.tabBar.hidden == YES) {
        
        self.tabBarController.tabBar.hidden = NO;
    }
    

}




- (void)viewDidLoad {
    [super viewDidLoad];
    self.titleLabel.text = @"订  单";
    self.view.backgroundColor = BACKGROUND2;
    
    
    self.rightBut.frame = CGRectMake(ViewWidth-90, 20, 90, 44) ;
    self.rightBut.hidden = NO;
    [self.rightBut setTitle:@"订单汇总" forState:UIControlStateNormal];
    [self.rightBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.rightBut.titleLabel.font = [UIFont systemFontOfSize:17];
    
    
    
    //    self.rightBut.backgroundColor = [UIColor greenColor];
    
    [self initItem];
    
}



-(void)rightButClick:(id)sender
{

    DDHZController *ddhz = [[DDHZController alloc]initWithNibName:nil bundle:nil];
    

//    [self setHidesBottomBarWhenPushed:YES];
    
    
    [self.navigationController pushViewController:ddhz animated:YES];



}

-(void)initItem
{
    
    
    
    self.tabedSlideView.baseViewController = self;
    self.tabedSlideView.tabItemNormalColor = [UIColor grayColor];
    self.tabedSlideView.tabItemSelectedColor = BenSe_COLOR;
    self.tabedSlideView.tabbarTrackColor = BenSe_COLOR;
    self.tabedSlideView.tabbarBackgroundImage = [UIImage imageNamed:@"tabbarBk"];
    DLTabedbarItem *item1 = [DLTabedbarItem itemWithTitle:@"备货中" image:[UIImage imageNamed:@""] selectedImage:[UIImage imageNamed:@""] font:[UIFont systemFontOfSize:17]];
    DLTabedbarItem *item2 = [DLTabedbarItem itemWithTitle:@"发货中" image:[UIImage imageNamed:@""] selectedImage:[UIImage imageNamed:@""] font:[UIFont systemFontOfSize:17]];
    
    DLTabedbarItem *item3 = [DLTabedbarItem itemWithTitle:@"已完成" image:[UIImage imageNamed:@""] selectedImage:[UIImage imageNamed:@""] font:[UIFont systemFontOfSize:17]];
    
    self.tabedSlideView.tabbarItems = @[item1, item2, item3];
    [self.tabedSlideView buildTabbar];
    
    self.tabedSlideView.selectedIndex = 0;


}


- (NSInteger)numberOfTabsInDLTabedSlideView:(DLTabedSlideView *)sender{
    return 3;
}



- (UIViewController *)DLTabedSlideView:(DLTabedSlideView *)sender controllerAt:(NSInteger)index{
    switch (index) {
        case 0:
        {
           
            
            OneViewController *ctrl = [[OneViewController alloc]initWithNibName:nil bundle:nil];
          
            
            
            
            
            
            
            return ctrl;
        }
        case 1:
        {
            TwoViewController *ctrl = [[TwoViewController alloc] initWithNibName:nil bundle:nil];
          
            return ctrl;
        }
        case 2:
        {
            ThreeViewController *ctrl = [[ThreeViewController alloc] initWithNibName:nil bundle:nil];
           
            return ctrl;
        }
            
        default:
            return nil;
    }
}


@end
